/**
 * destructable components of the Defender's protection
 * @author Chris
 */
public class Base extends GameObject{

	final int MAX_INTEGRITY;
	
	/**
	 * frameindex is in {0,4,8,12,15} indicating which subimage of the BASE_COMPONENTS Sprite will be displayed
	 * BASE_COMPONENTS is organized so indices {0..3} contain the damage levels for a single section type, and
	 * so on for {4..7}, etc.
	 * @param x
	 * @param y
	 * @param frameindex
	 */
	Base(int x, int y, int frameindex){
		super(x, y, SpriteLib.BASE_COMPONENTS);
		MAX_INTEGRITY = 4+frameindex; // to account for the flexible starting image_index
		image_index = frameindex;
	}
	
	public void takeDamage(){
		image_index++;
	}
	
	public int structuralIntegrity(){
		return (MAX_INTEGRITY - image_index);
	}
}
